package com.zmn.oms.task;

import com.github.ltsopensource.spring.boot.annotation.EnableJobClient;
import com.github.ltsopensource.spring.boot.annotation.EnableTaskTracker;
import com.zmn.manager.common.database.config.OneMasterMultiSlaveDataSourceConfiguration;
import com.zmn.manager.mq.annotation.EnableMQConsume;
import com.zmn.manager.mq.annotation.EnableMQSend;
import com.zmn.manager.sharding.annotation.EnableMyIdAutoAlloter;
import com.zmn.oms.manager.utils.SpringBeanFactoryUtil;
import com.zmn.oms.task.config.InsDataSourceConfig;
import com.zmn.oms.task.config.ThreadPoolConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication(exclude = {RabbitAutoConfiguration.class, DataSourceAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class, RestClientAutoConfiguration.class})
@ComponentScan(basePackages = "com.zmn.oms")
@ImportAutoConfiguration( classes = {
        ThreadPoolConfig.class,
        InsDataSourceConfig.class
})
@Import({SpringBeanFactoryUtil.class, OneMasterMultiSlaveDataSourceConfiguration.class})
//@EnableElasticsearchRepositories(basePackageClasses = {
//        EsOrderWorkService.class,
//        EsOrderPartService.class,
//        EsOrderPayService.class
//})
@EnableJobClient
@EnableTaskTracker
@EnableTransactionManagement
@EnableAsync
@EnableMyIdAutoAlloter
// @EnableCatElasticsearch
@EnableMQSend
@EnableMQConsume
public class TaskApplication {

    public static void main(String[] args) {
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        SpringApplication.run(TaskApplication.class, args);
    }
}
